<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highsecondary" content="no">
    <meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width">

    <title>查看询价 -采方</title>
    <link href="../lib/fonts/material-icons.css?family=Material+Icons" rel="stylesheet">
    <link href="../lib/css/animate.min.css" rel="stylesheet">
    <link href="../lib/css/quasar.mat.rtl.min.css" rel="stylesheet" type="text/css">
    <style>
      [v-cloak] { display: none }
      div.q-field-vertical .q-field-label+.q-field-content { padding-top: 0!important }
      .search-group-left { font-size: 13px; border: 1px solid #ccc; padding: 3px 6px!important; border-radius: 3px 0 0 3px; border-right: none }
      .search-group-right { font-size: 13px;border: 1px solid #ccc; padding: 3px 6px!important; border-radius: 0 3px 3px 0 }
      .ant-input { font-size: 13px;border: 1px solid #ccc; padding: 3px 6px!important; border-radius: 3px }
    </style>
  </head>
  <body>
    <div id="q-rfxPurPreview" v-cloak>
      <q-layout>
        <q-page-container>
          <q-tabs inverted color="primary" v-model="selectedTab">
            <q-tab default slot="title" name="tab-1" label="基本信息"></q-tab>
            <q-tab slot="title" name="tab-2" label="行项目"></q-tab>
            <q-tab slot="title" name="tab-3" label="附件"></q-tab>
            <q-tab slot="title" name="tab-4" label="供应商"></q-tab>

            <q-tab-pane name="tab-1" class="relative-position">
              <div class="row justify-start gutter-x-sm gutter-y-xs q-pb-md q-px-sm" style="font-size:13px">
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    询价主题：
                    <span class="text-light">{{ baseInfoForm.title }}</span>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    询价类型：
                    <q-chip v-if="baseInfoForm.type==1" dense square color="positive">项目</q-chip>
                    <q-chip v-if="baseInfoForm.type==2" dense square color="positive">调价</q-chip>
                    <q-chip v-if="baseInfoForm.type==3" dense square color="positive">产品变更</q-chip>
                    <q-chip v-if="baseInfoForm.type==4" dense square color="positive">工程变更</q-chip>
                    <q-chip v-if="baseInfoForm.type==5" dense square color="positive">供方变更</q-chip>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    是否密封报价：
                    <q-chip v-if="baseInfoForm.isSeal==1" dense square color="positive">是</q-chip>
                    <q-chip v-if="baseInfoForm.isSeal==0" dense square color="light">否</q-chip>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    采购组织：
                    <span class="text-light">{{ baseInfoForm.purOrgName }}</span>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    采购组：
                    <span class="text-light">{{ baseInfoForm.purGroupName }}</span>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    采购执行人：
                    <span class="text-light">{{ baseInfoForm.purExecutorName }}</span>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    是否需要报名：
                    <q-chip v-if="baseInfoForm.isSignUp==1" dense square color="positive">是</q-chip>
                    <q-chip v-if="baseInfoForm.isSignUp==0" dense square color="light">否</q-chip>
                </div>
                <div v-if="baseInfoForm.isSignUp==1" class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    报名开始时间：
                    <span class="text-light">{{ baseInfoForm.signUpStartTime }}</span>
                </div>
                <div v-if="baseInfoForm.isSignUp==1" class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    报名截止时间：
                    <span class="text-light">{{ baseInfoForm.signUpEndTime }}</span>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    报价开始时间：
                    <span class="text-light">{{ baseInfoForm.quoteStartTime }}</span>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    报价截止时间：
                    <span class="text-light">{{ baseInfoForm.quoteEndTime }}</span>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    报价允许修改次数：
                    <span class="text-light">{{ baseInfoForm.quoteModifyTimes }}</span>
                </div>
                <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    是否需要TR评审：
                    <q-chip v-if="baseInfoForm.isTr==1" dense square color="positive">是</q-chip>
                    <q-chip v-if="baseInfoForm.isTr==0" dense square color="light">否</q-chip>
                </div>
                <div v-if="baseInfoForm.trFileId" class="col-lg-4 col-md-6 col-sm-12 col-xs-12 q-mt-sm">
                    TR文件：
                    <a 
                      href="javascript:;" 
                      class="text-primary" 
                      @click="downloadFile(baseInfoForm.trFileId)">下载</a>
                </div>
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 q-mt-sm">
                    报价说明：
                    <span class="text-light">{{ baseInfoForm.remark }}</span>
                </div>
              </div>
              <q-inner-loading :visible="visible">
                <q-spinner-gears size="50px" color="primary"></q-spinner-gears>
              </q-inner-loading>
            </q-tab-pane>
            <q-tab-pane name="tab-2">
              <q-card class="bg-white no-shadow full-width">
                <q-card-main class="relative-position">
                  <div class="row justify-between">
                    <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                      <q-btn
                        color="primary"
                        outline
                        size="xs"
                        label="维护核算价"
                        @click="reviewPriceChange"
                        class="q-mr-sm" ></q-btn>
                    </div>
                    <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 row justify-end">
                      <q-input 
                        class="search-group-left"
                        hide-underline
                        placeholder="输入名称、编码"
                        v-model.trim="searchForm.value"></q-input>
                      <q-select 
                        class="search-group-right"
                        hide-underline
                        radio
                        :options="[{ label:'名称', value: 'matName' }, { label:'编码', value: 'matCode' }]"
                        v-model="searchForm.key"></q-select>
                      <q-btn
                        size="sm"
                        color="primary"
                        :loading="btnLoadingSearch"
                        @click="searchDetails"
                        class="q-ml-sm q-pa-sm">
                        <span slot="loading">
                          <q-spinner-hourglass></q-spinner-hourglass>
                          搜索中
                        </span>
                        <q-icon name="search"></q-icon>
                        <span>{{ $t('查询') }}</span>
                      </q-btn>
                      <q-btn
                        size="sm"
                        color="secondary"
                        @click="resetDetails"
                        :loading="btnLoadingReset"
                        class="q-ml-sm q-pa-sm">
                        <span slot="loading">
                          <q-spinner-hourglass></q-spinner-hourglass>
                          重置中
                        </span>
                        <q-icon name="refresh" ></q-icon>
                        <span>{{ $t('重置') }}</span>
                      </q-btn>
                    </div>
                  </div>
                  <q-table
                    class="no-shadow"
                    :data="detailsTableData"
                    dense
                    hide-bottom
                    :columns="columns"
                    :rows-per-page-options="[5, 10, 20]"
                    selection="multiple"
                    :loading="listLoading"
                    :selected.sync="selected"
                    :pagination.sync="serverPagination"
                    @request="DetailsListGet"
                    row-key="id"
                  >
                    <template slot="body" slot-scope="props">
                      <q-tr
                        :props="props"
                      >
                        <q-td >
                          <q-checkbox color="primary" v-model="props.selected"></q-checkbox>
                        </q-td>
                        <q-td key="action" :props="props" >
                          <q-btn
                            flat
                            size="xs"
                            color="primary"
                            class="q-pa-xs"
                            v-if="props.row.pricingStatus!=0"
                            @click="lookFixedPrice(props.row.id, props.row.pricingStatus)"
                          >
                            查看定价
                          </q-btn>
                          <span v-else>- -</span>
                        </q-td>
                        <q-td key="matName" :props="props" >
                          {{ props.row.matName }}
                        </q-td>
                        <q-td key="matCode" :props="props" >
                          {{ props.row.matCode }}
                        </q-td>
                        <q-td key="matPictureCode" :props="props" >
                          {{ props.row.matPictureCode }}
                        </q-td>
                        <q-td key="matCategoryName" :props="props" >
                          {{ props.row.matCategoryName }}
                        </q-td>
                        <q-td key="carSeriesName" :props="props" >
                          {{ props.row.carSeriesName }}
                        </q-td>
                        <q-td key="quantity" :props="props" >
                          {{ props.row.quantity }}
                        </q-td>
                        <q-td key="unitName" :props="props" >
                          {{ props.row.unitName }}
                        </q-td>
                        <q-td key="carQuantity" :props="props" >
                          {{ props.row.carQuantity }}
                        </q-td>
                        <q-td key="currencyName" :props="props" >
                          {{ props.row.currencyName }}
                        </q-td>
                        <q-td key="quoteTempName" :props="props" >
                          {{ props.row.quoteTempName }}
                        </q-td>
                        <q-td key="targetPrice" :props="props" >
                          {{ props.row.targetPrice }}
                        </q-td>
                        <q-td key="adjustPrice" :props="props" >
                          {{ props.row.adjustPrice }}
                        </q-td>
                        <q-td key="isMoldCostShare" :props="props" >
                          <q-chip v-if="props.row.isMoldCostShare == 1" dense square color="positive">是</q-chip>
                          <q-chip v-if="props.row.isMoldCostShare == 0" dense square color="light">否</q-chip>
                        </q-td>
                        <q-td key="sorCode" :props="props" >
                          {{ props.row.sorCode }}
                        </q-td>
                        <q-td key="projectCode" :props="props" >
                          {{ props.row.projectCode }}
                        </q-td>
                        <q-td key="proposerName" :props="props" >
                          {{ props.row.proposerName }}
                        </q-td>
                        <q-td key="requiredFinishTime" :props="props" >
                          {{ props.row.requiredFinishTime }}
                        </q-td>
                        <q-td key="productLineName" :props="props" >
                          {{ props.row.productLineName }}
                        </q-td>
                        <q-td key="shareType" :props="props" >
                          <q-chip v-if="props.row.isMoldCostShare == 1" dense square color="info">一次性成本摊销</q-chip>
                          <q-chip v-if="props.row.isMoldCostShare == 2" dense square color="info">基于时间摊销</q-chip>
                          <q-chip v-if="props.row.isMoldCostShare == 3" dense square color="info">基于数量摊销</q-chip>
                        </q-td>
                        <q-td key="shareQuantity" :props="props" >
                          {{ props.row.shareQuantity + props.row.shareUnitName }}
                        </q-td>
                        <q-td key="sharePaymentTime" :props="props" >
                          {{ props.row.sharePaymentTime }}
                        </q-td>
                      </q-tr>
                      <q-tr v-show="props.expand" :props="props">
                        <q-td colspan="100%">
                          审核原因：{{ props.row.approveReason }}
                        </q-td>
                      </q-tr>
                    </template>
                  </q-table>
                  <div class="row justify-end items-center text-faded">
                    每页的行数：
                    <q-select 
                      :options="[{label: '5', value: 5},{label: '10', value: 10},{label: '20', value: 20}]" 
                      hide-underline
                      class="q-mr-md"
                      v-model="serverPagination.rowsPerPage"></q-select>
                    第
                    <q-pagination
                      class="q-mt-xs"
                      v-model="serverPagination.page"
                      input
                      boundary-links
                      direction-links
                      :max-pages="5"
                      :ellipses="true"
                      :max="pages"></q-pagination>
                    页 &nbsp; 共 {{ total }} 条
                  </div>
                  <q-inner-loading :visible="visible">
                    <q-spinner-gears size="50px" color="primary"></q-spinner-gears>
                  </q-inner-loading>
                </q-card-main>
              </q-card>
            </q-tab-pane>
            <q-tab-pane name="tab-3">
              <q-card class="bg-white no-shadow full-width">
                <q-card-main class="q-px-md q-py-sm relative-position">
                  <q-table
                    class="no-shadow"
                    :data="fileTableData"
                    dense
                    hide-bottom
                    :columns="fileColumns"
                    :rows-per-page-options="[5, 10, 20]"
                    :loading="listLoading"
                    :pagination.sync="serverPaginationFile"
                    @request="fileListGet"
                    row-key="id"
                  >
                    <template slot="body" slot-scope="props">
                      <q-tr
                        :props="props"
                      >
                        <q-td key="action" :props="props" >
                          <q-btn
                            flat
                            size="xs"
                            color="primary"
                            class="q-pa-xs"
                            @click="downloadFile(props.row.id)"
                          >
                            下载
                          </q-btn>
                        </q-td>
                        <q-td key="fileName" :props="props" >
                          {{ props.row.fileName }}
                        </q-td>
                        <q-td key="suffix" :props="props" >
                          {{ props.row.suffix }}
                        </q-td>
                        <q-td key="updateUserName" :props="props" >
                          {{ props.row.updateUserName }}
                        </q-td>
                        <q-td key="lastUpdateTime" :props="props" >
                          {{ props.row.lastUpdateTime }}
                        </q-td>
                        <q-td key="remark" :props="props" >
                          {{ props.row.remark }}
                        </q-td>
                      </q-tr>
                    </template>
                  </q-table>
                  <div class="row justify-end items-center text-faded">
                    每页的行数：
                    <q-select 
                      :options="[{label: '5', value: 5},{label: '10', value: 10},{label: '20', value: 20}]" 
                      hide-underline
                      class="q-mr-md"
                      v-model="serverPaginationFile.rowsPerPage"></q-select>
                    第
                    <q-pagination
                      class="q-mt-xs"
                      v-model="serverPaginationFile.page"
                      input
                      boundary-links
                      direction-links
                      :max-pages="5"
                      :ellipses="true"
                      :max="pagesFile"></q-pagination>
                    页 &nbsp; 共 {{ totalFile }} 条
                  </div>
                  <q-inner-loading :visible="visible">
                    <q-spinner-gears size="50px" color="primary"></q-spinner-gears>
                  </q-inner-loading>
                </q-card-main>
              </q-card>
            </q-tab-pane>
            <q-tab-pane name="tab-4">
              <q-card class="bg-white no-shadow full-width">
                <q-card-main class="relative-position">
                  <div class="row justify-between">
                    <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                      <q-btn
                        color="primary"
                        outline
                        size="xs"
                        label="PSA查询"
                        @click="psaSearch"
                        class="q-mr-sm" ></q-btn>
                    </div>
                    <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 row justify-end">
                      <q-input 
                        class="search-group-left"
                        hide-underline
                        placeholder="输入名称、编号"
                        v-model.trim="searchFormSup.value"></q-input>
                      <q-select 
                        class="search-group-right"
                        hide-underline
                        radio
                        :options="[{ label:'名称', value: 'supplierName' }, { label:'编码', value: 'supplierCode' }]"
                        v-model="searchFormSup.key"></q-select>
                      <q-btn
                        size="sm"
                        color="primary"
                        :loading="btnLoadingSearch"
                        @click="searchSup"
                        class="q-ml-sm q-pa-sm">
                        <span slot="loading">
                          <q-spinner-hourglass></q-spinner-hourglass>
                          搜索中
                        </span>
                        <q-icon name="search"></q-icon>
                        <span>{{ $t('查询') }}</span>
                      </q-btn>
                      <q-btn
                        size="sm"
                        color="secondary"
                        @click="resetSup"
                        :loading="btnLoadingReset"
                        class="q-ml-sm q-pa-sm">
                        <span slot="loading">
                          <q-spinner-hourglass></q-spinner-hourglass>
                          重置中
                        </span>
                        <q-icon name="refresh" ></q-icon>
                        <span>{{ $t('重置') }}</span>
                      </q-btn>
                    </div>
                  </div>
                  <q-table
                    class="no-shadow"
                    :data="supTableData"
                    dense
                    hide-bottom
                    :columns="supColumns"
                    :rows-per-page-options="[5, 10, 20]"
                    selection="multiple"
                    :loading="listLoading"
                    :selected.sync="selectedSup"
                    :pagination.sync="serverPaginationSup"
                    @request="supListGet"
                    row-key="id"
                  >
                    <template slot="body" slot-scope="props">
                      <q-tr
                        :props="props"
                      >
                        <q-td >
                          <q-checkbox color="primary" v-model="props.selected"></q-checkbox>
                        </q-td>
                        <q-td key="action" :props="props" >
                          <q-btn
                            flat
                            size="xs"
                            color="primary"
                            class="q-pa-xs"
                            v-if="!props.row.quoteStatus == 0"
                            @click="quoteModalOpen(props.row.id)"
                          >
                            查看报价
                          </q-btn>
                          <q-btn
                            flat
                            size="xs"
                            color="primary"
                            class="q-pa-xs"
                            v-if="props.row.trApproveStatus==0 && props.row.trFileId"
                            @click="trReviewModalOpen(props.row.id)"
                          >
                            TR审核
                          </q-btn>
                        </q-td>
                        <q-td key="supplierCode" :props="props" >
                          {{ props.row.supplierCode }}
                        </q-td>
                        <q-td key="supplierName" :props="props" >
                          {{ props.row.supplierName }}
                        </q-td>
                        <q-td key="supplierStep" :props="props" >
                          {{ props.row.supplierStep }}
                          <!-- <q-chip v-if="props.row.supplierStep == 1" dense square color="positive">正式</q-chip>
                          <q-chip v-if="props.row.supplierStep == 2" dense square color="light">潜在</q-chip> -->
                        </q-td>
                        <q-td key="signUpStatus" :props="props" >
                          <q-chip v-if="props.row.signUpStatus == -1" dense square color="negative">已拒绝</q-chip>
                          <q-chip v-if="props.row.signUpStatus == 1" dense square color="positive">已报名</q-chip>
                          <q-chip v-if="props.row.signUpStatus == 0" dense square color="light">未报名</q-chip>
                        </q-td>
                        <q-td key="quoteStatus" :props="props" >
                          <q-chip v-if="props.row.quoteStatus == 0" dense square color="light">未报价</q-chip>
                          <q-chip v-if="props.row.quoteStatus == 1" dense square color="positive">已报价</q-chip>
                          <q-chip v-if="props.row.quoteStatus == 2" dense square color="info">报价中</q-chip>
                        </q-td>
                        <q-td key="trApproveStatus" :props="props" >
                          <q-chip v-if="props.row.trApproveStatus == -1" dense square color="negative">驳回</q-chip>
                          <q-chip v-if="props.row.trApproveStatus == 1" dense square color="positive">通过</q-chip>
                          <q-chip v-if="props.row.trApproveStatus == 0" dense square color="light">未评审</q-chip>
                        </q-td>
                        <q-td key="trFileId" :props="props" >
                          <a href="javascript:;" v-if="props.row.trFileId" class="text-primary" @click="downloadFile(props.row.trFileId)">下载</a>
                          <a href="javascript:;" v-else class="text-primary">暂无</a>
                        </q-td>
                        <q-td key="remark" :props="props" >
                          {{ props.row.remark }}
                        </q-td>
                      </q-tr>
                    </template>
                  </q-table>
                  <div class="row justify-end items-center text-faded">
                    每页的行数：
                    <q-select 
                      :options="[{label: '5', value: 5},{label: '10', value: 10},{label: '20', value: 20}]" 
                      hide-underline
                      class="q-mr-md"
                      v-model="serverPaginationSup.rowsPerPage"></q-select>
                    第
                    <q-pagination
                      class="q-mt-xs"
                      v-model="serverPaginationSup.page"
                      input
                      boundary-links
                      direction-links
                      :max-pages="5"
                      :ellipses="true"
                      :max="pagesSup"></q-pagination>
                    页 &nbsp; 共 {{ totalSup }} 条
                  </div>
                  <q-inner-loading :visible="visible">
                    <q-spinner-gears size="50px" color="primary"></q-spinner-gears>
                  </q-inner-loading>
                </q-card-main>
              </q-card>
            </q-tab-pane>
          </q-tabs>
          <q-page-sticky position="top-right" :offset="[32,20]">
            <q-fab
              color="primary"
              icon="keyboard_arrow_down"
              direction="down"
            >
              <q-fab-action 
                v-if="baseInfoForm.status == 1 && baseInfoForm.isClose != 1"
                color="primary" 
                @click="quoteEndTimeOpen"
                icon="edit">
                <q-tooltip anchor="center left" self="center right" :offset="[10, 10]">修改报价截止日期</q-tooltip>
              </q-fab-action>
              <q-fab-action 
                v-if="baseInfoForm.status == 1 && baseInfoForm.isClose != 1"
                color="primary" 
                @click="comparePrice"
                icon="compare_arrows">
                <q-tooltip anchor="center left" self="center right" :offset="[10, 10]">比价分析</q-tooltip>
              </q-fab-action>
              <q-fab-action 
                v-if="baseInfoForm.isClose != 1 && baseInfoForm.status == 1 && baseInfoForm.isOfficial != 1"
                color="primary" 
                @click="officeQuote"
                icon="send">
                <q-tooltip anchor="center left" self="center right" :offset="[10, 10]">发起正式报价</q-tooltip>
              </q-fab-action>
              <q-fab-action 
                v-if="baseInfoForm.status == 0 && baseInfoForm.isClose != 1"
                color="primary" 
                @click="activate"
                icon="send">
                <q-tooltip anchor="center left" self="center right" :offset="[10, 10]">激活</q-tooltip>
              </q-fab-action>
              <q-fab-action 
                color="secondary" 
                @click="window.location.href='./rfxPurList.html'"
                icon="arrow_back">
                <q-tooltip anchor="center left" self="center right" :offset="[10, 10]">返回</q-tooltip>
              </q-fab-action>
            </q-fab>
          </q-page-sticky>
        </q-page-container>
      </q-layout>
      <!-- tr 评审 -->
      <q-modal no-backdrop-dismiss v-model="trReviewModal" :content-css="{minWidth: '44vw', minHeight: '400px',borderRadius: '4px'}">
        <q-modal-layout>
          <q-toolbar slot="header" color="white">
            <q-toolbar-title class="text-dark">
              <span>审核</span>
            </q-toolbar-title>
            <q-btn flat @click="trReviewModal = false">
              <q-icon name="close" color="dark"></q-icon>
            </q-btn>
          </q-toolbar>
          <q-card class="bg-white no-shadow full-width">
            <q-card-main class="row justify-center gutter-x-md gutter-y-xs">
              <q-field 
                label="类型"
                :label-width="2"
                class="col-lg-10 col-md-10 col-sm-12 col-xs-12">
                <div class="row no-wrap q-pt-xs">
                  <q-radio class="col" v-model="trReviewForm.approveFlag" :val="1" label="通过"></q-radio>
                  <q-radio class="col" v-model="trReviewForm.approveFlag" :val="-1" label="驳回"></q-radio>
                </div>
              </q-field>
              <q-field 
                label="原因"
                :label-width="2"
                class="col-lg-10 col-md-10 col-sm-6 col-xs-12 q-mt-sm">
                <q-input 
                  type="textarea"
                  rows="5"
                  hide-underline
                  class="ant-input"
                  v-model="trReviewForm.remark" ></q-input>
              </q-field>
            </q-card-main>
          </q-card>
          <q-toolbar slot="footer" color="white" class="row justify-end">
            <q-btn
              glossy
              :loading="btnLoading"
              color="primary"
              size="sm"
              @click="trReviewConfirm">{{$t("保存")}}</q-btn>
            <q-btn
              glossy
              color="secondary"
              size="sm"
              class="q-ml-sm"
              @click="trReviewModal = false">{{$t("取消")}}</q-btn>
          </q-toolbar>
        </q-modal-layout>
      </q-modal>
      <!-- 修改报价截止时间 -->
      <q-modal no-backdrop-dismiss v-model="quoteEndTimeModal" :content-css="{minWidth: '44vw', minHeight: '400px',borderRadius: '4px'}">
        <q-modal-layout>
          <q-toolbar slot="header" color="white">
            <q-toolbar-title class="text-dark">
              <span>编辑</span>
            </q-toolbar-title>
            <q-btn flat @click="quoteEndTimeModal = false">
              <q-icon name="close" color="dark"></q-icon>
            </q-btn>
          </q-toolbar>
          <q-card class="bg-white no-shadow full-width">
            <q-card-main class="row justify-center gutter-x-md gutter-y-xs">
              <q-field 
                label="报价截止时间"
                orientation="vertical"
                :error="$v.editQuoteTimeForm.quoteEndTime.$error"
                error-label="该字段为必填项"
                class="col-lg-10 col-md-10 col-sm-6 col-xs-12 q-mt-sm">
                <q-datetime 
                  type="datetime"
                  format="YYYY-MM-DD HH:mm:ss"
                  format-model="string"
                  @blur="$v.editQuoteTimeForm.quoteEndTime.$touch"
                  v-model="editQuoteTimeForm.quoteEndTime" ></q-datetime>
              </q-field>
            </q-card-main>
          </q-card>
          <q-toolbar slot="footer" color="white" class="row justify-end">
            <q-btn
              glossy
              :loading="btnLoading"
              color="primary"
              size="sm"
              @click="editQuoteTimeConfirm">{{$t("保存")}}</q-btn>
            <q-btn
              glossy
              color="secondary"
              size="sm"
              class="q-ml-sm"
              @click="quoteEndTimeModal = false">{{$t("取消")}}</q-btn>
          </q-toolbar>
        </q-modal-layout>
      </q-modal>
      <!-- 查看报价 -->
      <q-modal no-backdrop-dismiss v-model="reQuoteModal" :content-css="{minWidth: '88vw', minHeight: '450px',borderRadius: '4px'}">
        <q-modal-layout>
          <q-toolbar slot="header" color="white">
            <q-toolbar-title class="text-dark">
              <span>查看报价</span>
            </q-toolbar-title>
            <q-btn flat @click="reQuoteModal = false">
              <q-icon name="close" color="dark"></q-icon>
            </q-btn>
          </q-toolbar>
          <q-card class="bg-white no-shadow full-width">
            <q-card-main class="position-relative">
              <q-table
                class="no-shadow"
                :data="quoteTableData"
                dense
                hide-bottom
                :columns="quoteColumns"
                :rows-per-page-options="[5, 10, 20]"
                selection="multiple"
                :loading="listLoading"
                :selected.sync="selectedQuote"
                :pagination.sync="serverPaginationQuote"
                @request="quoteListGet"
                row-key="id"
              >
                <template slot="body" slot-scope="props">
                    <q-tr
                    :props="props"
                  >
                    <q-td >
                      <q-checkbox color="primary" v-model="props.selected"></q-checkbox>
                    </q-td>
                    <q-td key="action" :props="props" >
                      <q-btn
                        flat
                        size="xs"
                        color="primary"
                        class="q-pa-xs"
                      >
                        查看明细
                      </q-btn>
                      <q-btn
                        flat
                        size="xs"
                        color="primary"
                        class="q-pa-xs"
                        v-if="props.row.rfqItemEntity.pricingStatus != 1"
                        @click="reQuoteConfirm(props.row.id)"
                      >
                        重新报价
                      </q-btn>
                    </q-td>
                    <q-td key="rfqItemEntity.matCode" :props="props" >
                      {{ props.row.rfqItemEntity.matCode }}
                    </q-td>
                    <q-td key="rfqItemEntity.matName" :props="props" >
                      {{ props.row.rfqItemEntity.matName }}
                    </q-td>
                    <q-td key="rfqItemEntity.quoteTempName" :props="props" >
                      {{ props.row.rfqItemEntity.quoteTempName }}
                    </q-td>
                    <q-td key="rfqSupplierEntity.supplierCode" :props="props" >
                      {{ props.row.rfqSupplierEntity.supplierCode }}
                    </q-td>
                    <q-td key="rfqSupplierEntity.supplierName" :props="props" >
                      {{ props.row.rfqSupplierEntity.supplierName }}
                    </q-td>
                    <q-td key="type" :props="props" >
                      <q-chip v-if="props.row.type == 1" dense square color="info">前期询价</q-chip>
                      <q-chip v-if="props.row.type == 2" dense square color="positive">正式报价</q-chip>
                    </q-td>
                    <q-td key="time" :props="props" >
                      {{ props.row.time }}
                    </q-td>
                    <q-td key="status" :props="props" >
                      <q-chip v-if="props.row.status == 0" dense square color="light">草稿</q-chip>
                      <q-chip v-if="props.row.status == 1" dense square color="positive">激活</q-chip>
                    </q-td>
                    <q-td key="quantity" :props="props" >
                      {{ props.row.quantity }}
                    </q-td>
                    <q-td key="productPrice" :props="props" >
                      {{ props.row.productPrice }}
                    </q-td>
                    <q-td key="nonProductPrice" :props="props" >
                      {{ props.row.nonProductPrice }}
                    </q-td>
                    <q-td key="totalPrice" :props="props" >
                      {{ props.row.totalPrice }}
                    </q-td>
                    <q-td key="currencyName" :props="props" >
                      {{ props.row.currencyName }}
                    </q-td>
                  </q-tr>
                </template>
              </q-table>
              <div class="row justify-end items-center text-faded">
                每页的行数：
                <q-select 
                  :options="[{label: '5', value: 5},{label: '10', value: 10},{label: '20', value: 20}]" 
                  hide-underline
                  class="q-mr-md"
                  v-model="serverPaginationQuote.rowsPerPage"></q-select>
                第
                <q-pagination
                  class="q-mt-xs"
                  v-model="serverPaginationQuote.page"
                  input
                  boundary-links
                  direction-links
                  :max-pages="5"
                  :ellipses="true"
                  :max="pagesQuote"></q-pagination>
                页 &nbsp; 共 {{ totalQuote }} 条
              </div>
              <q-inner-loading :visible="visibleQuote">
                <q-spinner-gears size="50px" color="primary"></q-spinner-gears>
              </q-inner-loading>
            </q-card-main>
          </q-card>
        </q-modal-layout>
      </q-modal>
      <!-- 维护核算价  -->
      <q-modal no-backdrop-dismiss v-model="priceChangeModal" :content-css="{minWidth: '44vw', minHeight: '400px',borderRadius: '4px'}">
        <q-modal-layout>
          <q-toolbar slot="header" color="white">
            <q-toolbar-title class="text-dark">
              <span>维护核算价</span>
            </q-toolbar-title>
            <q-btn flat @click="priceChangeModal = false">
              <q-icon name="close" color="dark"></q-icon>
            </q-btn>
          </q-toolbar>
          <q-card class="bg-white no-shadow full-width">
            <q-card-main class="row justify-center gutter-x-md gutter-y-xs">
              <q-field 
                label="核算价"
                orientation="vertical"
                :error="$v.adjustPriceForm.adjustPrice.$error"
                :error-label="$v.adjustPriceForm.adjustPrice.required? '请输入数字': '该字段为必填项'"
                class="col-lg-10 col-md-10 col-sm-6 col-xs-12 q-mt-sm">
                <q-input 
                  @blur="$v.adjustPriceForm.adjustPrice.$touch"
                  v-model="adjustPriceForm.adjustPrice" ></q-input>
              </q-field>
            </q-card-main>
          </q-card>
          <q-toolbar slot="footer" color="white" class="row justify-end">
            <q-btn
              glossy
              :loading="btnLoading"
              color="primary"
              size="sm"
              @click="priceChangeConfirm">{{$t("保存")}}</q-btn>
            <q-btn
              glossy
              color="secondary"
              size="sm"
              class="q-ml-sm"
              @click="priceChangeModal = false">{{$t("取消")}}</q-btn>
          </q-toolbar>
        </q-modal-layout>
      </q-modal>
    </div>
    
    <!-- ie-polyfill 、 vue.js and quasar-framework -->
    <script src="../lib/js/quasar.ie.polyfills.umd.min.js"></script>
    <script src="../lib/js/vue.js"></script>
    <script src="../lib/js/quasar.mat.umd.min.js"></script>
    <!-- babel for es6 transform -->
    <!-- <script src="lib/js/babel.min.js"></script> -->
    <!-- vue validate -->
    <script src="../lib/js/vuelidate.min.js"></script>
    <script src="../lib/js/validators.min.js"></script>
    <!-- consts and utils ps: always leave this file first -->
    <script src="../script/consts.js"></script>
    <script src="../script/utils.js"></script>
    <!-- status code -->
    <script src="../script/status.code.js"></script>
    <!-- qs for axios -->
    <script src="../lib/js/qs.min.js"></script>
    <!-- axios for http request -->
    <script src="../lib/js/axios.js"></script>
    <!-- axios.instance must be after axios -->
    <script src="../script/axios.instance2.js"></script>
    <!-- quasar i18n zh-hans -->
    <script src="../lib/lang/zh-hans.js"></script>
    <!-- vue-i18n for application's internationalization -->
    <script src="../lib/js/vue-i18n.js"></script>
    <!-- current page international file -->
    <script src="../lang/sor/rfxPurPreview.js"></script>

    <script>
			// quasar components use
      Quasar.i18n.set(Quasar.i18n[LANGUGE])
      Vue.prototype.window = window
      Vue.use(window.vuelidate.default)
      var required = window.validators.required
      var helpers = window.validators.helpers
      var mustNumber = function(value) {
        return /^\d+(\.\d+)?$|^$/.test(value) || !helpers.req(value)
      }
			new Vue({
        el: '#q-rfxPurPreview',
        i18n: i18n,
				data: function() {
					return {
            // 通用
            currentId: '',
            currentSupId: '',
            selectedTab: 'tab-1',
            trReviewModal: false,
            quoteEndTimeModal: false,
            reQuoteModal: false,
            priceChangeModal: false,
            listLoading: false,
            btnLoading: false,
            btnLoadingSearch: false,
            btnLoadingReset: false,
            visible: false,
            visibleQuote: false,
            isOptions: [
              {
                label: '是',
                value: 1
              },
              {
                label: '否',
                value: 0
              }
            ],
            editQuoteTimeForm: {
              quoteEndTime: ''
            },
            // 基本信息
            baseInfoForm: {
              title: null,
              type: null,
              purOrgName: null,
              purGroupName: null,
              purExecutorName: null,
              isSeal: null,
              isSignUp: 1,
              signUpStartTime: null,
              signUpEndTime: null,
              quoteStartTime: null,
              quoteEndTime: null,
              quoteModifyTimes: null,
              isTr: 1,
              trFileId: null,
              remark: ''
            },
            // 行项目
            searchForm: {
              value: '',
              key: 'matName'
            },
            detailsTableData: [],
            total: 0,
            serverPagination: {
              page: 1,
              rowsPerPage: 10,
              rowsNumber: 10
            },
            selected: [],
            // 附件
            fileTableData: [],
            totalFile: 0,
            serverPaginationFile: {
              page: 1,
              rowsPerPage: 10,
              rowsNumber: 10
            },
            // 供应商
            searchFormSup: {
              value: '',
              key: 'supplierName'
            },
            supTableData: [],
            totalSup: 0,
            serverPaginationSup: {
              page: 1,
              rowsPerPage: 10,
              rowsNumber: 10
            },
            selectedSup: [],
            trReviewForm: {
              approveFlag: 1,
              remark: ''
            },
            //     供应商上报价列表
            quoteTableData: [],
            totalQuote: 0,
            serverPaginationQuote: {
              page: 1,
              rowsPerPage: 5,
              rowsNumber: 5
            },
            selectedQuote: [],
            // 维护核算价
            adjustPriceForm: {
              adjustPrice: ''
            }
          }
        },
        validations: {
          editQuoteTimeForm: {
            quoteEndTime: { required: required }
          },
          adjustPriceForm: {
            adjustPrice: { required: required, mustNumber: mustNumber }
          }
        },
				computed: {
          columns: function() {
            return [
              {
                name: 'action',
                label: '操作',
                align: 'center',
                field: 'action'
              },
              {
                name: 'matName',
                label: '零件名称',
                align: 'center',
                field: 'matName'
              },
              {
                name: 'matCode',
                label: '零件编号',
                align: 'center',
                field: 'matCode'
              },
              {
                name: 'matPictureCode',
                label: '零件图号',
                align: 'center',
                field: 'matPictureCode'
              },
              {
                name: 'matCategoryName',
                label: '品类',
                align: 'center',
                field: 'matCategoryName'
              },
              {
                name: 'carSeriesName',
                label: '所属车型',
                align: 'center',
                field: 'carSeriesName'
              },
              {
                name: 'quantity',
                label: '数量',
                align: 'center',
                field: 'quantity'
              },
              {
                name: 'unitName',
                label: '价格单位',
                align: 'center',
                field: 'unitName'
              },
              {
                name: 'carQuantity',
                label: '单车用量',
                align: 'center',
                field: 'carQuantity'
              },
              {
                name: 'currencyName',
                label: '币种',
                align: 'center',
                field: 'currencyName'
              },
              {
                name: 'quoteTempName',
                label: '报价模板',
                align: 'center',
                field: 'quoteTempName'
              },
              {
                name: 'targetPrice',
                label: '目标单价',
                align: 'center',
                field: 'targetPrice'
              },
              {
                name: 'adjustPrice',
                label: '核算价格',
                align: 'center',
                field: 'adjustPrice'
              },
              {
                name: 'isMoldCostShare',
                label: '模具摊销',
                align: 'center',
                field: 'isMoldCostShare'
              },
              {
                name: 'sorCode',
                label: '源SOR编码',
                align: 'center',
                field: 'sorCode'
              },
              {
                name: 'projectCode',
                label: '源项目编码',
                align: 'center',
                field: 'projectCode'
              },
              {
                name: 'proposerName',
                label: '申请人',
                align: 'center',
                field: 'proposerName'
              },
              {
                name: 'requiredFinishTime',
                label: '要求定点时间',
                align: 'center',
                field: 'requiredFinishTime'
              },
              {
                name: 'productLineName',
                label: '产品线',
                align: 'center',
                field: 'productLineName'
              },
              {
                name: 'shareType', // 1：一次性成本摊销  2：基于时间摊销 3：基于数量摊销
                label: '摊销类型',
                align: 'center',
                field: 'shareType'
              },
              {
                name: 'shareQuantity',
                label: '摊销数量或时间',
                align: 'center',
                field: 'shareQuantity'
              },
              {
                name: 'sharePaymentTime',
                label: '付款时间',
                align: 'center',
                field: 'sharePaymentTime'
              }
            ]
          },
          pages: function() {
            return Math.ceil(this.total/this.serverPagination.rowsPerPage)
          },
          fileColumns: function() {
            return [
              {
                name: 'action',
                label: '操作',
                align: 'center',
                field: 'action'
              },
              {
                name: 'fileName',
                label: '文件名称',
                align: 'center',
                field: 'fileName'
              },
              {
                name: 'suffix',
                label: '格式',
                align: 'center',
                field: 'suffix'
              },
              {
                name: 'updateUserName',
                label: '修改人',
                align: 'center',
                field: 'updateUserName'
              },
              {
                name: 'lastUpdateTime',
                label: '修改日期',
                align: 'center',
                field: 'lastUpdateTime'
              },
              {
                name: 'remark',
                label: '说明',
                align: 'center',
                field: 'remark'
              },
            ]
          },
          pagesFile: function() {
            return Math.ceil(this.totalFile/this.serverPaginationFile.rowsPerPage)
          },
          supColumns: function() {
            return [
              {
                name: 'action',
                label: '操作',
                align: 'center',
                field: 'action'
              },
              {
                name: 'supplierCode',
                label: '供应商编码',
                align: 'center',
                field: 'supplierCode'
              },
              {
                name: 'supplierName',
                label: '供应商名称',
                align: 'center',
                field: 'supplierName'
              },
              {
                name: 'supplierStep',
                label: '供应商阶段',
                align: 'center',
                field: 'supplierStep'
              },
              {
                name: 'signUpStatus',
                label: '是否报名',
                align: 'center',
                field: 'signUpStatus'
              },
              {
                name: 'quoteStatus',
                label: '报价状态',
                align: 'center',
                field: 'quoteStatus'
              },
              {
                name: 'trApproveStatus',
                label: 'TR评审状态',
                align: 'center',
                field: 'trApproveStatus'
              },
              {
                name: 'trFileId',
                label: 'TR审核材料',
                align: 'center',
                field: 'trFileId'
              },
              {
                name: 'remark',
                label: '备注',
                align: 'center',
                field: 'remark'
              }
            ]
          },
          pagesSup: function() {
            return Math.ceil(this.totalSup/this.serverPaginationSup.rowsPerPage)
          },
          quoteColumns: function() {
            return [
              {
                name: 'action',
                label: '操作',
                align: 'center',
                field: 'action'
              },
              {
                name: 'rfqItemEntity.matCode',
                label: '物料编码',
                align: 'center',
                field: 'rfqItemEntity.matCode'
              },
              {
                name: 'rfqItemEntity.matName',
                label: '物料名称',
                align: 'center',
                field: 'rfqItemEntity.matName'
              },
              {
                name: 'rfqItemEntity.quoteTempName',
                label: '报价模板',
                align: 'center',
                field: 'rfqItemEntity.quoteTempName'
              },
              {
                name: 'rfqSupplierEntity.supplierCode',
                label: '供应商编号',
                align: 'center',
                field: 'rfqSupplierEntity.supplierCode'
              },
              {
                name: 'rfqSupplierEntity.supplierName',
                label: '供应商名称',
                align: 'center',
                field: 'rfqSupplierEntity.supplierName'
              },
              {
                name: 'type',
                label: '报价类型',
                align: 'center',
                field: 'type'
              },
              {
                name: 'time',
                label: '轮次',
                align: 'center',
                field: 'time'
              },
              {
                name: 'status',
                label: '状态',
                align: 'center',
                field: 'status'
              },
              {
                name: 'quantity',
                label: '数量',
                align: 'center',
                field: 'quantity'
              },
              {
                name: 'productPrice',
                label: '生产报价',
                align: 'center',
                field: 'productPrice'
              },
              {
                name: 'nonProductPrice',
                label: '非生产报价',
                align: 'center',
                field: 'nonProductPrice'
              },
              {
                name: 'totalPrice',
                label: '总价',
                align: 'center',
                field: 'totalPrice'
              },
              {
                name: 'currencyName',
                label: '币种',
                align: 'center',
                field: 'currencyName'
              },
            ]
          },
          pagesQuote: function() {
            return Math.ceil(this.totalQuote/this.serverPaginationQuote.rowsPerPage)
          },
        },
        watch: {
          selectedTab: function(selectedTab) {
            if (selectedTab == 'tab-1') {
              this.baseInfoGet()
            }
            if (selectedTab == 'tab-2') {
              this.DetailsListGet({ pagination:this.serverPagination })
            }
            if (selectedTab == 'tab-3') {
              this.fileListGet({ pagination:this.serverPaginationFile })
            }
            if (selectedTab == 'tab-4') {
              this.supListGet({ pagination:this.serverPaginationSup })
            }
          },
          'serverPagination.rowsPerPage': function(rowsPerPage) {
            this.DetailsListGet({ pagination: this.serverPagination })
          },
          'serverPagination.page': function(page) {
            this.DetailsListGet({ pagination: this.serverPagination })
          },
          'serverPaginationFile.rowsPerPage': function(rowsPerPage) {
            this.fileListGet({ pagination: this.serverPaginationFile })
          },
          'serverPaginationFile.page': function(page) {
            this.fileListGet({ pagination: this.serverPaginationFile })
          },
          'serverPaginationSup.rowsPerPage': function(rowsPerPage) {
            this.supListGet({ pagination: this.serverPaginationSup })
          },
          'serverPaginationSup.page': function(page) {
            this.supListGet({ pagination: this.serverPaginationSup })
          },
          'serverPaginationQuote.rowsPerPage': function(rowsPerPage) {
            this.quoteListGet({ pagination: this.serverPaginationQuote })
          },
          'serverPaginationQuote.page': function(page) {
            this.quoteListGet({ pagination: this.serverPaginationQuote })
          }
        },
        created: function() {
          var args = GetRequest()
          this.currentId = args.id
          this.baseInfoGet()
        },
				methods: {
          // 基本信息
					baseInfoGet: function(arg) {
            var that = this
            this.visible = true
            axios({
              method: 'post',
              url: '/manager/rfq/main/getMainInfo/' + this.currentId,
            })
            .then(function(data) {
              that.baseInfoForm = data.data
              setTimeout(function() {
                that.visible = false
              }, 500)
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          // 行项目
          DetailsListGet: function(arg) {
            var that = this 
            this.listLoading = true
            this.visible = true
            this.serverPagination = arg.pagination
            axios({
              method: 'post',
              url: '/manager/rfq/item/query',
              data: {
                page: this.serverPagination.page,
                rows: this.serverPagination.rowsPerPage,
                sort: this.serverPagination.sortBy,
                order: this.serverPagination.descending == true? 'desc' : (this.serverPagination.descending == false? 'asc' : null),
                search_LIKE_matName: this.searchForm.key == 'matName'? this.searchForm.value: '',
                search_LIKE_matCode: this.searchForm.key == 'matCode'? this.searchForm.value: '',
                search_EQ_headerId: this.currentId
              }
            })
            .then(function(data) {
              that.detailsTableData = data.rows
              that.total = data.total
              that.listLoading = false
              setTimeout(function() {
                that.visible = false
              }, 500);
              that.btnLoadingSearch = false
              that.btnLoadingReset = false
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          // 明细 查询
          searchDetails: function() {
            this.btnLoadingSearch = true
            this.DetailsListGet({
              pagination: this.serverPagination
            })
          },
          resetDetails: function() {
            this.btnLoadingReset = true
            this.searchForm = {  
              value: '',
              key: 'matName'
            }
            this.DetailsListGet({
              pagination: this.serverPagination
            })
          },
          // 查看定价
          lookFixedPrice: function(id, pricingStatus) {
            window.location.href = "./rfxPurFixPrice.html?id=" + this.currentId
          },
          // 附件
          fileListGet: function(arg) {
            var that = this 
            this.listLoading = true
            this.visible = true
            this.serverPaginationFile = arg.pagination
            axios({
              method: 'post',
              url: '/manager/rfq/file/query',
              data: {
                page: this.serverPaginationFile.page,
                rows: this.serverPaginationFile.rowsPerPage,
                sort: this.serverPaginationFile.sortBy,
                order: this.serverPaginationFile.descending == true? 'desc' : (this.serverPaginationFile.descending == false? 'asc' : null),
                search_EQ_busId: this.currentId
              }
            })
            .then(function(data) {
              that.fileTableData = data.rows
              that.totalFile = data.total
              that.listLoading = false
              setTimeout(function() {
                that.visible = false
              }, 500);
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          downloadFile: function(id) {
            window.location.href = baseURL +'/manager/rfq/file/download/'+id
          },
          // 供应商 获取
          supListGet: function(arg) {
            var that = this 
            this.listLoading = true
            this.visible = true
            this.serverPaginationSup = arg.pagination
            axios({
              method: 'post',
              url: '/manager/rfq/supplier/query',
              data: {
                page: this.serverPaginationSup.page,
                rows: this.serverPaginationSup.rowsPerPage,
                sort: this.serverPaginationSup.sortBy,
                order: this.serverPaginationSup.descending == true? 'desc' : (this.serverPaginationSup.descending == false? 'asc' : null),
                search_LIKE_supplierCode: this.searchFormSup.key == 'supplierCode'? this.searchFormSup.value: '',
                search_LIKE_supplierName: this.searchFormSup.key == 'supplierName'? this.searchFormSup.value: '',
                search_EQ_headerId: this.currentId
              }
            })
            .then(function(data) {
              that.supTableData = data.rows
              that.totalSup = data.total
              that.listLoading = false
              setTimeout(function() {
                that.visible = false
              }, 500);
              that.btnLoadingSearch = false
              that.btnLoadingReset = false
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          // tr评审
          trReviewModalOpen: function(id) {
            this.trReviewForm = {
              approveFlag: 1,
              remark: ''
            }
            this.currentSupId = id
            this.trReviewModal = true
          },
          trReviewConfirm: function() {
            var that = this
            this.btnLoading = true
            axios({
              method: 'post',
              url: '/manager/rfq/supplier/trApprove/'+this.currentSupId,
              data: this.trReviewForm
            })
            .then(function(data) {
              if (data.success) {
                that.$q.notify({
                  message: '操作成功',
                  type: 'positive',
                  icon: 'done',
                  timeout: 1000,
                  position: 'top-right'
                })
              } else {
                that.$q.notify({
                  message: data.msg,
                  type: 'negative',
                  icon: 'error_outline',
                  timeout: 1000,
                  position: 'top-right'
                })
              }
              that.btnLoading = false
              that.trReviewModal = false
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          // 查看报价
          quoteModalOpen: function(id) {
            var that = this
            axios({
              method: 'post',
              url: '/manager/rfq/main/validateQuoteEndTime/'+this.currentId,
            })
            .then(function(data) {
              if (data.success) {
                that.reQuoteModal = true
                that.currentSupId = id
                that.quoteListGet({ pagination: that.serverPaginationQuote })
              } else {
                that.$q.notify({
                  message: data.msg,
                  type: 'negative',
                  icon: 'error_outline',
                  timeout: 2000,
                  position: 'top-right'
                })
              }
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          quoteListGet: function(arg) {
            var that = this 
            this.listLoading = true
            this.visibleQuote = true
            this.serverPaginationQuote = arg.pagination
            axios({
              method: 'post',
              url: '/manager/rfqvendor/quote/queryByRfqSupplierId/' + this.currentSupId,
              data: {
                page: this.serverPaginationQuote.page,
                rows: this.serverPaginationQuote.rowsPerPage,
                sort: this.serverPaginationQuote.sortBy,
                order: this.serverPaginationQuote.descending == true? 'desc' : (this.serverPaginationQuote.descending == false? 'asc' : null),
              }
            })
            .then(function(data) {
              that.quoteTableData = data.rows
              that.totalQuote = data.total
              that.listLoading = false
              setTimeout(function() {
                that.visibleQuote = false
              }, 500);
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          reQuoteConfirm: function(id) {
            var that = this
            this.$q.dialog({
              title: '确认',
              message: '确认要重新报价吗？',
              ok: {
                label: '确认',
                flat: true
              },
              cancel: {
                label: '取消',
                flat: true
              }
            })
            .then(function() {
              axios({
                method: 'post',
                url: '/manager/rfqvendor/quote/reQuote/'+ id,
              })
              .then(function(data) {
                if (data.success) {
                  that.$q.notify({
                    message: '操作成功',
                    type: 'positive',
                    icon: 'done',
                    timeout: 1000,
                    position: 'top-right'
                  })
                } else {
                  that.$q.notify({
                    message: data.msg,
                    type: 'negative',
                    icon: 'error_outline',
                    timeout: 1000,
                    position: 'top-right'
                  })
                }
                that.quoteListGet()
              })
              .catch(function(err) {
                console.log(err)
              })
            })
            .catch(function() {

            })
          },
          // 查询
          searchSup: function()  {
            this.btnLoadingSearch = true
            this.supListGet({
              pagination: this.serverPaginationSup
            })
          },
          resetSup: function()  {
            this.btnLoadingReset = true
            this.searchFormSup = {  
              value: '',
              key: 'supplierName'
            }
            this.supListGet({
              pagination: this.serverPaginationSup
            })
          },
          psaSearch: function() {

          },
          // 修改报价截止日期
          quoteEndTimeOpen: function() {
            this.quoteEndTimeModal = true
            this.editQuoteTimeForm = {
              quoteEndTime: this.baseInfoForm.quoteEndTime
            },
            this.$v.editQuoteTimeForm.$reset()
          },
          editQuoteTimeConfirm: function() {
            var that = this
            this.btnLoading = true
            this.editQuoteTimeForm.quoteEndTime = timeUtil(this.editQuoteTimeForm.quoteEndTime)
            axios({
              method: 'post',
              url: '/manager/rfq/main/modifyQuoteEndTime/'+ this.currentId,
              data: this.editQuoteTimeForm
            })
            .then(function(data) {
              if (data.success) {
                that.$q.notify({
                  message: '操作成功',
                  type: 'positive',
                  icon: 'done',
                  timeout: 1000,
                  position: 'top-right'
                })
              } else {
                that.$q.notify({
                  message: data.msg,
                  type: 'negative',
                  icon: 'error_outline',
                  timeout: 1000,
                  position: 'top-right'
                })
              }
              that.quoteEndTimeModal = false
              that.btnLoading = false
              that.baseInfoGet()
            })
            .catch(function(err) {
              console.log(err)
            })
          },
          // 发起正式报价
          officeQuote: function() {
            var that = this
            this.$q.dialog({
              title: '确认',
              message: '确认要发起正式报价吗？',
              ok: {
                label: '确认',
                flat: true
              },
              cancel: {
                label: '取消',
                flat: true
              }
            })
            .then(function() {
              axios({
                method: 'post',
                url: '/manager/rfq/main/submitOfficialPrice/'+ that.currentId,
              })
              .then(function(data) {
                if (data.success) {
                  that.$q.notify({
                    message: '操作成功',
                    type: 'positive',
                    icon: 'done',
                    timeout: 1000,
                    position: 'top-right'
                  })
                } else {
                  that.$q.notify({
                    message: data.msg,
                    type: 'negative',
                    icon: 'error_outline',
                    timeout: 1000,
                    position: 'top-right'
                  })
                }
                that.baseInfoGet()
              })
              .catch(function(err) {
                console.log(err)
              })
            })
            .catch(function() {

            })
          },
          // 激活
          activate: function() {
            var that = this
            this.$q.dialog({
              title: '确认',
              message: '执行激活操作，同时您可以选择是否发布正式询价',
              ok: {
                label: '确认',
                flat: true
              },
              cancel: {
                label: '取消',
                flat: true
              },
              options: {
                type: 'radio', // 或者'checkbox' / 'toggle'
                model: 0, // 使用数组，当checkbox/toggle时! (like '[]')
                items: [
                  {label: '普通询价', value: 0 },
                  {label: '正式询价', value: 1 }
                ]
              }
            })
            .then(function(data) {
              axios({
                method: 'post',
                url: '/manager/rfq/main/active/' + data,
                data: {
                  ids: that.currentId
                }
              })
              .then(function(data) {
                if (data.success) {
                  that.$q.notify({
                    message: '操作成功',
                    type: 'positive',
                    icon: 'done',
                    timeout: 1000,
                    position: 'top-right'
                  })
                  window.location.href = './rfxPurList.html'
                } else {
                  that.$q.notify({
                    message: data.msg,
                    type: 'negative',
                    icon: 'error_outline',
                    timeout: 1000,
                    position: 'top-right'
                  })
                }
              })
              .catch(function(err) {
                console.log(err)
              })
            })
            .catch(function() {
              // 选择"Cancel"或作了关闭操作
            })
          },
          // 维护核算价
          reviewPriceChange: function() {
            if (this.selected.length > 0) {
              this.adjustPriceForm = {
                adjustPrice: ''
              }
              this.priceChangeModal = true
            } else {
              this.$q.notify({
                message: '请先勾选，再执行该操作',
                type: 'warning',
                icon: 'warning',
                timeout: 1000,
                position: 'top-right'
              })
            }
          },
          priceChangeConfirm: function() {
            var that = this
            this.$v.adjustPriceForm.$touch()
            if (!this.$v.adjustPriceForm.$error) {
              var idSelected = []
              this.selected.forEach(function(e) {
                idSelected.push(e.id)
              })
              this.btnLoading = true
              axios({
                method: 'post',
                url: '/manager/rfq/item/updateAdjustPrice',
                data: {
                  ids: idSelected.join(','),
                  adjustPrice: this.adjustPriceForm.adjustPrice
                }
              })
              .then(function(data) {
                if (data.success) {
                  that.$q.notify({
                    message: '操作成功',
                    type: 'positive',
                    icon: 'done',
                    timeout: 1000,
                    position: 'top-right'
                  })
                  that.btnLoading = false
                  that.priceChangeModal = false
                  that.DetailsListGet({
                    pagination: that.serverPagination
                  })
                } else {
                  that.$q.notify({
                    message: data.msg,
                    type: 'negative',
                    icon: 'error_outline',
                    timeout: 1000,
                    position: 'top-right'
                  })
                }
              })
              .catch(function(err) {
                console.log(err)
              })
            }
          },
          comparePrice: function() {
            if (this.baseInfoForm.isSeal) {
              var that = this
              axios({
                method: 'post',
                url: '/manager/rfq/main/validateQuoteEndTime/'+that.currentId,
              })
              .then(function(data) {
                if (data.success) {
                  window.location.href = './rfxPurCompare.html?id='+that.currentId
                } else {
                  that.$q.notify({
                    message: data.msg,
                    type: 'negative',
                    icon: 'error_outline',
                    timeout: 2000,
                    position: 'top-right'
                  })
                }
              })
              .catch(function(err) {
                console.log(err)
              })
            } else {
              window.location.href = './rfxPurCompare.html?id='+this.currentId
            }
          } 
				}
			})
    </script>
  </body>
</html>